/*
 * FXGL - JavaFX Game Library. The MIT License (MIT).
 * Copyright (c) AlmasB (almaslvl@gmail.com).
 * See LICENSE for details.
 */

package com.windea.study.kotlin.fxgl.sample.sandbox

import com.almasb.fxgl.app.*
import com.almasb.fxgl.core.math.*
import com.almasb.fxgl.dsl.*
import com.almasb.fxgl.dsl.components.*
import com.almasb.fxgl.entity.level.text.*
import com.almasb.fxgl.ui.*
import com.windea.breezeframework.fxgl.extensions.entity.*

/**
 * @author Almas Baimagambetov (almaslvl@gmail.com)
 */
class BasicLevelApp : GameApplication() {
	override fun initSettings(settings: GameSettings) {
		settings.cssList = listOf("test_fxgl_light.css")
	}
	
	override fun initGame() {
		getGameWorld().addEntityFactory(MyEntityFactory())
		
		val level = getAssetLoader().loadLevel("test_level.txt", TextLevelLoader(30, 30, '0'))
		
		getGameWorld().setLevel(level)
		
		spawn("rect", 750.0, 550.0)
		
		getGameWorld().getRandom { true }?.addComponent(ProjectileComponent(FXGLMath.randomPoint2D(), 250.0))
	}
	
	override fun initUI() {
		addUINode(FXGLButton("HELLO"), 100.0, 100.0)
	}
}


fun main(args: Array<String>) {
	GameApplication.launch(BasicLevelApp::class.java, args)
}

